# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7
inherit eutils cmake-utils git-r3 desktop

DESCRIPTION="A cross-platform soundboard loud_sound"
HOMEPAGE="https://soundux.rocks/"

EGIT_REPO_URI="https://github.com/Soundux/Soundux.git"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS=
IUSE=""
RESTRICT="test"

DEPEND="
        x11-libs/libX11
        x11-libs/libXi
        x11-base/xorg-proto
        net-libs/webkit-gtk
"

RDEPEND="${DEPEND}"

src_install() {
    #emake DESTDIR="${D}" install
    insopts -m644
    
    newicon "${S}/assets/icon.png" "soundux.png"
    domenu "${FILESDIR}/soundux.desktop"
    
    mkdir -p "${D}/opt/${PN}/dist"
    insinto  "/opt/${PN}/"
    into  "/opt/${PN}/"
    #This application actually expects to be next to its dist folder.. so we install everything manually in /opt and make a symlik to the binary in /usr/bin. Like this it works fine.
    exeinto  "/opt/${PN}/"
    dostrip "${WORKDIR}/${P}_build/soundux"
    doexe "${WORKDIR}/${P}_build/soundux"
    
    
    dosym "/opt/${PN}/${PN}" "/usr/bin/${PN}"
    


    doins -r "${S}/build/dist/"
}

pkg_postinst() {
        xdg_desktop_database_update 
}

pkg_postrm() {
        xdg_desktop_database_update 
}

